/**
 * @module navigator页面跳转
 */

import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
import { NavigationParams } from 'react-navigation';

/**
 * @see [react-native官方文档](https://reactnavigation.org/docs/zh-Hans/navigation-prop.html)
 * @param fd: IFeidaoAiMobile;	// 系统参数
 * @param routeName: string;	// 页面名
 * @param params: string;	// 向跳转页面传入的参数
 * @see [api](https://dfeidao.gitee.io/feidao-web/browser/local)
 * @example
 * ```ts
 * import replace from '@dfeidao/atom-mobile/navigator/replace';
 * replace({ routeName: 'home', params: { id: '', name: '' } }); // 带参数
 * replace({ routeName: 'home' }); // 不带参数
 * ```
 */

export default function replace(fd: IFeidaoAiMobile, routeName: string, params?: NavigationParams) {
	return fd.page.props.navigation.replace(routeName, params);
}

